const { Service } = require('egg');

class UserService extends Service {
    async getuser(name) {  
        //查询该用户是否注册
        let res = await this.app.mysql.query(`select * from user where name='${name}'`);
        return res;
    }
    async registry(name, pwd) { 
        //注册
        let res = await this.app.mysql.query(`insert into user (name,pwd) values ('${name}','${pwd}')`);
        return res;
    }
    async login(name,pwd){
        let res = await this.app.mysql.query(`select * from user where name='${name}' and pwd='${pwd}'`);
        return res;
    }
}
module.exports = UserService;